module.exports = mongoose => {
  const UserSchema = new mongoose.Schema({
    'uid': {type: Number},
    'username': {type: String},
    'email': {type: String},
    'nick': {type: String},
    'portrait': {type: String},
    'roles': [String], // trans to enum
    'admin_uid': {type: Number},
    'confirmed': {type: Boolean},
    'create_time': {type: Date},
    'update_time': {type: Date},
    'password': {type: String}
  }, {
    collection: 'user'
  })

  return mongoose.model('User', UserSchema)
}
